package com.jfinal.code.eclipse.plugin.generator.db;

import com.jfinal.plugin.activerecord.dialect.Dialect;
import com.jfinal.plugin.activerecord.dialect.MysqlDialect;
import com.jfinal.plugin.activerecord.dialect.OracleDialect;
import com.jfinal.plugin.activerecord.dialect.PostgreSqlDialect;
import com.jfinal.plugin.activerecord.dialect.SqlServerDialect;
import com.jfinal.plugin.activerecord.dialect.Sqlite3Dialect;

/**
 * JFinal Dialect Factory
 * @author yaolin
 *
 */
public class JFinalDialectFactory {

	public static Dialect getDialectByDbType(DbType dbType) {
		switch (dbType) {
		case MySQL:
			return new MysqlDialect();
		case Oracle:
			return new OracleDialect();
		case SQLServer:
			return new SqlServerDialect();
		case PostgreSQL:
			return new PostgreSqlDialect();
		case SQLLite3:
			return new Sqlite3Dialect();
		default:
			return new MysqlDialect(); // def
		}
	}
}
